package SVN::TeamTools::Store::Status;

use warnings;
use strict;
use Carp;
use Error qw(:try);

use SVN::TeamTools::Store::Repo;
use SVN::TeamTools::Store::SvnIndex;
use SVN::TeamTools::Store::DepIndex;
use SVN::TeamTools::Store::StatsDB;

use HTML::Template;

my $conf;
my $logger;
BEGIN { $conf = SVN::TeamTools::Store::Config->new(); $logger = $conf->{logger}; }

sub hasAction {
        shift;
        my %args        = @_;
        my $action      = $args{action};
        return ("|dsp.status|" =~ /\|\Q$action\E\|/);
}

sub getTemplate {
	shift;
	my %args	= @_;

	my $template	= HTML::Template->new( filename => 'SVN/TeamTools/Store/tmpl/status.tmpl', path => \@INC);
	my $repo	= SVN::TeamTools::Store::Repo->new();
	my $svnindex	= SVN::TeamTools::Store::SvnIndex->new(mode=>"r",create=>0);
	my $depindex 	= SVN::TeamTools::Store::DepIndex->new (mode=>"r", create=>0);
	my $statsdb	= SVN::TeamTools::Store::StatsDB->new(create=>0);

 	$template->param (p_rev_svn		=> $repo->getSvnRev());
 	$template->param (p_rev_svnindex	=> $svnindex->getIndexRev());
 	$template->param (p_rev_depindex	=> $depindex->getIndexRev());
 	$template->param (p_rev_statsdb		=> $statsdb->lastRev());

	return $template;
}
1;
